(() => {
    const container = document.createElement("div")
    container.style.position = "fixed";
    container.style.right = "200px";
    container.style.bottom = "200px";
    const btn = document.createElement("button")
    const input = document.createElement("input")
    input.value = "3000"
    const menu = [{
        value: 379832,
        label: "高热"
    }, {
        value: 309480,
        label: "上架"
    }]
    const select = document.createElement("select");
    for (const { value, label } of menu) {
        const option = document.createElement("option")
        option.value = value;
        option.text = label;
        select.appendChild(option)
    }
    select.value = menu[0].value
    container.appendChild(select)
    container.appendChild(input)
    container.appendChild(btn)
    document.body.appendChild(container);




    let stat = false;
    let time;
    const getDate = () => {
        const d = new Date();
        const year = d.getFullYear()
        const month = d.getMonth() + 1
        const date = d.getDate();
        const s = `${year}-${`0${month}`.slice(-2)}-${`0${date}`.slice(-2)}`;
        const start_time = `${s} 00:00:00`
        const end_time = `${s} 23:59:59`
        return { start_time, end_time }
    }
    const start = () => {
        btn.innerText = "暂停"
        const ms = parseInt(input.value);
        time = setInterval(() => {
            post()
        }, ms);
    }
    const end = () => {
        btn.innerText = "点击开始"
        clearInterval(time);
    }
    const click = () => {
        stat = !stat;
        if (stat) start()
        else end();
    }
    btn.onclick = click;
    end()
    const post = () => {
        const { start_time, end_time } = getDate();
        // const queryData = {
        //     service_id: "2388",
        //     game_id: "690841190",
        //     ugc_type: "pic",
        //     evil_type: "0",
        //     audit_type: "1",
        //     audit_once_evil_type: "0"
        // }
        const source = parseInt(select.value);
        fetch(
            "https://ace.qq.com/mtp_esb/cgi/reviews/tasks/claim?service_id=2388&game_id=690841190&ugc_type=pic&evil_type=0&audit_type=1&audit_once_evil_type=0",
            {
                method: "post",
                body: JSON.stringify({
                    "game_id": 690841190,
                    "ugc_type": "pic",
                    "evil_type": 0,
                    // "source": 379832,
                    source,
                    "scene": 0,
                    "data_scene": "",
                    start_time,
                    end_time,
                    "task_num": 100,
                    "audit_type": 1,
                    "account": "",
                    "last_audit_result": 0,
                    "content_id": "",
                    "audit_once_evil_type": 0
                })
            }
        )
    }


})()